package net.xju3_4.dao;



import net.xju3_4.common.utils.JdbcUtilsV1;
import net.xju3_4.entity.vo.ShoppingCar;


import java.util.List;

public class ShoppingCarDao {

    // 添加订单项
    public static int addOrderItem(ShoppingCar orderItem) {
        String sql = "INSERT INTO order_item (order_id, book_id, book_title, price, quantity) VALUES (?, ?, ?, ?, ?)";
        Object[] params = {
                orderItem.getOrderId(),
                orderItem.getBookId(),
                orderItem.getBookTitle(),
                orderItem.getPrice(),
                orderItem.getQuantity()
        };
        return JdbcUtilsV1.executeUpdate(sql, params);
    }

    // 删除订单项
    public static int deleteOrderItem(Integer itemId) {
        String sql = "DELETE FROM order_item WHERE item_id = ?";
        Object[] params = { itemId };
        return JdbcUtilsV1.executeUpdate(sql, params);
    }
}
//